import React, { useRef, useState } from 'react';

const FullScreen: React.FC = () => {
  const [full, setFull] = useState(false);
  const domRef = useRef(null);
  const alterFull = () => {
    setFull(!full);
    (domRef as any).current.parentElement.classList.toggle('fullScreen');
  };
  return (
    <button
      ref={domRef}
      type="button"
      style={{ position: 'absolute', right: '0px', top: '0px' }}
      onClick={alterFull}
    >
      {full ? '退出全屏' : '全屏'}
    </button>
  );
};
export default FullScreen;
